package ooday04;

public class AnimalTest {
    public static void main(String[] args) {

        Animal[]animals=new Animal[5];
        animals[0]=new Dog("",5,"");
        animals[1]=new Dog("",5,"");
        animals[2]=new Fish("",5,"");
        animals[3]=new Fish("",5,"");
        animals[4]=new Chick("",5,"");
        for (int i=0;i<animals.length;i++){
            System.out.println(animals[i].name);
            animals[i].drink();
            animals[i].eat();
            if (animals[i] instanceof Dog){
                Dog dog=(Dog) animals[i];
                dog.lookhome();
            }
            if(animals[i] instanceof Chick){
                Chick chick=(Chick)animals[i];
                chick.layeggs();
            }
            if(animals[i] instanceof Swim){
                Swim s=(Swim)animals[i];
                s.swim();
            }
        }






/*
        Master master = new Master();
        Dog dog = new Dog("小白", 3, "白");
        Fish fish = new Fish("小金", 2, "金");
        Chick chick = new Chick("小彩", 1, "彩");
        master.feed(dog);
        master.feed(fish);
        master.feed(chick);

 */


    }
}
